package com.ezjie.login.task;

import java.util.HashMap;
import java.util.Map;
import com.ezjie.baselib.core.http.HttpAPI;
import com.ezjie.baselib.core.http.HttpRequestCallBack;
import com.ezjie.baselib.core.http.ServerInterfaceDefinition;
import com.ezjie.login.InterfaceInfo.ServiceInterface;

import android.content.Context;

public class LoginTask {
	
	private Context context;

	public LoginTask(Context context) {
		this.context = context;
	}
	/**
	 * 登录
	 * @param username
	 * @param password
	 * @param type   类型 1手机  2邮箱
	 * @param httpRequestCallBack
	 */
	public void doLogin(int sendType,String username,String password,HttpRequestCallBack httpRequestCallBack){
		Map<String, String> params = new HashMap<String, String>();
		if (sendType == 1) {
			params.put("mobile", username);
		}else if (sendType == 2) {
			params.put("email", username);
		}
		params.put("password", password);
		
		HttpAPI.getInstance(context,ServiceInterface.API_USER_BASE).doPostRequest(
				ServiceInterface.OPT_LOGIN, params,
				httpRequestCallBack);
	}
	
	
}
